/**
 * @author Almas software technologies muhtarjaan mahmood (مۇختەرجان مەخمۇت)
 * @email ug-project@outlook.com
 * @create date 2022-07-05 19:29:34
 * @modify date 2022-07-05 19:29:34
 * @desc [description]
*/

#[derive(Debug)]
pub struct Message {
    pub key: String,
    pub value: Vec<u8>,
}
impl Clone for Message {
    fn clone(&self) -> Self {
        Self { key: self.key.clone(), value: self.value.clone() }
    }
}

impl Into<crate::protocol_buffer::entity::Message> for Message {
    fn into(self) -> crate::protocol_buffer::entity::Message {
        crate::protocol_buffer::entity::Message {
            key: self.key,
            value: self.value,
            created_at: 0,
            sent_by: "".into(),
        }
    }
}

impl Into<Message> for crate::protocol_buffer::entity::Message {
    fn into(self) -> Message {
        Message { key: self.key, value: self.value }
    }
}